home *** CD-ROM | disk | FTP | other *** search
- ;_ stdio.asm Modified by Joe Huffman October 21, 1990
- ; Copyright (C) 1985-1990 by Walter Bright */
- ; All rights reserved. */
-
- ; Standard I/O header file */
-
- EOF equ -1
-
- ifdef M_I386
-
- BUFSIZ equ 4096
-
- ifdef DOS386
- _ptr equ 0
- _cnt equ _ptr + SIZEPTR
- _base equ _cnt + 4
- _flag equ _base + SIZEPTR
- _file equ _flag + 4
- _bufsiz equ _file + 4
- else
- ifdef __OS2__
- _ptr equ 0
- _cnt equ 4
- _base equ 8
- _flag equ 12
- _file equ 16
- _charbuf equ 20
- _bufsiz equ 24
- __tmpnum equ 28
- else
- ifdef __NT__
- _ptr equ 0
- _cnt equ 4
- _base equ 8
- _flag equ 12
- _file equ 16
- _bufsiz equ 20
- __tmpnum equ 24
- else ; M_UNIX and M_XENIX
- _cnt equ 0
- _ptr equ _cnt + 4
- _base equ _ptr + SIZEPTR
- _flag equ _base + SIZEPTR
- _file equ _flag + 1
- endif
- endif
- endif
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Thread data structure (one is allocated per thread)
- ;Must match __thread1 in cinit.asm and struct THREAD in mt.h
-
- ifdef __NT__
- thread_t struc
- t_stackoff dd 0
- ; t_stackseg dw 0
- t_parameter dd 0
- t_func dd 0
- t_stacktop dd 0
- t_errno dd 0
- ; if SPTR
- t_strtok dd 0
- ; else
- ; t_strtok df 0
- ; endif
- ; ifdef __NT__
- t_id dd 0 ;thread id
- t_hndl dd 0 ;thread handle
- t_envptr dd 0 ;pointer to malloced memory for getenv return
- ; endif
- t_tm dd 9 dup (0) ;struct tm
-
- ;Actually t_fenv
- t_fe_status dw 0
- t_fe_control dw 0
- t_fe_round dw 0
- t_fe_res1 dw 0
- t_fe_res2 dw 0
-
- t_asctime db 26 dup (0)
- t_digstr db 32 dup (0) ;DBL_DIG*2+2
- thread_t ends
- else
- thread_t struc
- t_stackoff dd 0
- ; t_stackseg dw 0
- t_parameter dd 0
- t_func dd 0
- t_stacktop dd 0
- t_errno dd 0
- ; if SPTR
- t_strtok dd 0
- ; else
- ; t_strtok df 0
- ; endif
- ; ifdef __NT__
- ; t_id dd 0 ;thread id
- ; t_hndl dd 0 ;thread handle
- ; t_envptr dd 0 ;pointer to malloced memory for getenv return
- ; endif
- t_tm dd 9 dup (0) ;struct tm
-
- ;Actually t_fenv
- t_fe_status dw 0
- t_fe_control dw 0
- t_fe_round dw 0
- t_fe_res1 dw 0
- t_fe_res2 dw 0
-
- t_asctime db 26 dup (0)
- t_digstr db 32 dup (0) ;DBL_DIG*2+2
- thread_t ends
- endif
-
- THDSIZE equ (size thread_t)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ifdef _MT
-
- ifndef noerrno
- if LCODE
- extrn __errno_set:far
- else
- extrn __errno_set:near
- endif
- endif
-
- errno_set macro value
- ifnb <value>
- mov EAX,value
- endif
- call __errno_set
- endm
-
- else
-
- ifndef noerrno
- begdata
- extrn _errno:dword
- enddata
- endif
-
- errno_set macro value
- ifnb <value>
- mov _errno,value
- else
- mov _errno,EAX
- endif
- endm
-
- endif
-
- else ;M_I386
-
- BUFSIZ equ 1024
- IF SPTR
- BIGBUF equ 20 * 1024
- ENDIF
-
- _ptr equ 0
- _cnt equ _ptr + SIZEPTR
- _base equ _cnt + 2
- _flag equ _base + SIZEPTR
- _file equ _flag + 2
- _bufsiz equ _file + 2
- IFDEF BIGBUF
- _seg equ _bufsiz + 2
- ENDIF
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;Thread data structure (one is allocated per thread)
- ;Must match __thread1 in cinit.asm and struct THREAD in mt.h
-
- thread_t struc
- t_stackoff dw 0
- t_stackseg dw 0
- t_stacktop dw 0
- t_errno dw 0
- if SPTR
- t_strtok dw 0
- else
- t_strtok dd 0
- endif
- t_tm dw 9 dup (0) ;struct tm
-
- ;Actually fenv_t
- t_fe_status dw 0
- t_fe_control dw 0
- t_fe_round dw 0
- t_fe_res1 dw 0
- t_fe_res2 dw 0
-
- t_asctime db 26 dup (0)
- t_digstr db 32 dup (0) ;DBL_DIG*2+2
- thread_t ends
-
- THDSIZE equ (size thread_t)
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ifdef _MT
-
- ifndef noerrno
- if LCODE
- extrn __errno_set:far
- else
- extrn __errno_set:near
- endif
- endif
-
- errno_set macro value
- ifnb <value>
- mov AX,value
- endif
- call __errno_set
- endm
-
- else
-
- ifndef noerrno
- begdata
- extrn _errno:word
- enddata
- endif
-
- errno_set macro value
- ifnb <value>
- mov _errno,value
- else
- mov _errno,AX
- endif
- endm
-
- endif
-
- endif
-
- _IOREAD equ 1
- _IOWRT equ 2
- _IONBF equ 4
- _IOMYBUF equ 8
- _IOEOF equ 10h
- _IOERR equ 20h
- _IOLBF equ 40h
- _IORW equ 80h
- _IOTRAN equ 100h
- _IOAPP equ 200h
- ifdef BIGBUF
- _IOBIGBUF equ 400h
- endif
-
-
- ;Values for errno
- ENOENT equ 2
- EACCES equ 13
- ENOMEM equ 8
- EINVAL equ 22
- EDEADLOCK equ 36
- EEXIST equ 80
- ERANGE equ 1003
-
-